package com.uetoken.cn.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.uetoken.cn.R;
import com.uetoken.cn.adapter.model.WalletsModel;
import com.uetoken.cn.manager.UEDataManager;


public class WalletsAdapter extends BaseQuickAdapter<WalletsModel, BaseViewHolder> {


    public WalletsAdapter() {
        super(R.layout.item_wallet_type, UEDataManager.getInstance().getWalletsModelList());
    }

    @Override
    protected void convert(final BaseViewHolder helper, WalletsModel item) {
        helper.setImageResource(R.id.walletIconIv, item.getWalletIcon());
        helper.setText(R.id.walletUnitTv, item.getWalletUnit());
        helper.setText(R.id.walletLimitTv, item.getWalletLimit());
        int backgroundRes;
        boolean isVisible = false;
        if (item.isSelected()) {
            backgroundRes = R.drawable.border_gray_shape_12;
            isVisible = true;
        } else {
            backgroundRes = R.drawable.border_gray_shape_13;
            isVisible = false;
        }
        helper.setVisible(R.id.walletSelIv, isVisible);
        helper.setBackgroundRes(R.id.walletLayout, backgroundRes);

    }
}
